home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb / foo / out < prev    next >
Encoding:
Text File  |  1990-11-20  |  19.8 KB  |  2,074 lines

  1. # 1 "blockframe.c"
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. # 1 "defs.h" 1
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. extern char *savestring ();
  48. extern char *concat ();
  49. extern char *xmalloc (), *xrealloc ();
  50. extern int parse_escape ();
  51. extern char *reg_names[];
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. extern int quit_flag;
  65.  
  66. extern int immediate_quit;
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. enum command_class
  74. {
  75.   no_class = -1, class_run = 0, class_vars, class_stack,
  76.   class_files, class_support, class_info, class_breakpoint,
  77.   class_alias, class_obscure, class_user,
  78. };
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. struct cleanup
  91. {
  92.   struct cleanup *next;
  93.   void (*function) ();
  94.   int arg;
  95. };
  96.  
  97. extern void do_cleanups ();
  98. extern void discard_cleanups ();
  99. extern struct cleanup *make_cleanup ();
  100. extern struct cleanup *save_cleanups ();
  101. extern void restore_cleanups ();
  102. extern void free_current_contents ();
  103. extern void reinitialize_more_filter ();
  104. extern void fputs_filtered ();
  105. extern void fprintf_filtered ();
  106. extern void printf_filtered ();
  107. extern void print_spaces_filtered ();
  108. extern char *tilde_expand ();
  109.  
  110.  
  111.  
  112.  
  113. struct command_line
  114. {
  115.   struct command_line *next;
  116.   char *line;
  117. };
  118.  
  119. struct command_line *read_command_lines ();
  120.  
  121.  
  122.  
  123. char *current_directory;
  124.  
  125. # 21 "blockframe.c" 2
  126.  
  127.  
  128. # 1 "symtab.h" 1
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. # 1 "./obstack.h" 1
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272. struct _obstack_chunk         
  273. {
  274.   char  *limit;             
  275.   struct _obstack_chunk *prev;     
  276.   char    contents[4];         
  277. };
  278.  
  279. struct obstack         
  280. {
  281.   long    chunk_size;         
  282.   struct _obstack_chunk* chunk;     
  283.   char    *object_base;         
  284.   char    *next_free;         
  285.   char    *chunk_limit;         
  286.   int    temp;             
  287.   int   alignment_mask;         
  288.   struct _obstack_chunk *(*chunkfun) ();  
  289.   void (*freefun) ();         
  290. };
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297. void obstack_init (struct obstack *obstack);
  298.  
  299. void * obstack_alloc (struct obstack *obstack, int size);
  300.  
  301. void * obstack_copy (struct obstack *obstack, void *address, int size);
  302. void * obstack_copy0 (struct obstack *obstack, void *address, int size);
  303.  
  304. void obstack_free (struct obstack *obstack, void *block);
  305.  
  306. void obstack_blank (struct obstack *obstack, int size);
  307.  
  308. void obstack_grow (struct obstack *obstack, void *data, int size);
  309. void obstack_grow0 (struct obstack *obstack, void *data, int size);
  310.  
  311. void obstack_1grow (struct obstack *obstack, int data_char);
  312.  
  313. void * obstack_finish (struct obstack *obstack);
  314.  
  315. int obstack_object_size (struct obstack *obstack);
  316.  
  317. int obstack_room (struct obstack *obstack);
  318. void obstack_1grow_fast (struct obstack *obstack, int data_char);
  319. void obstack_blank_fast (struct obstack *obstack, int size);
  320.  
  321. void * obstack_base (struct obstack *obstack);
  322. void * obstack_next_free (struct obstack *obstack);
  323. int obstack_alignment_mask (struct obstack *obstack);
  324. int obstack_chunk_size (struct obstack *obstack);
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384. # 244 "./obstack.h"
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417. # 286 "./obstack.h"
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426. # 369 "./obstack.h"
  427.  
  428.  
  429.  
  430.  
  431. # 20 "symtab.h" 2
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439. extern struct obstack *symbol_obstack;
  440. extern struct obstack *psymbol_obstack;
  441.  
  442.  
  443.  
  444.  
  445. extern char *xmalloc ();
  446. extern void free ();
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462. enum misc_function_type {mf_unknown = 0, mf_text, mf_data, mf_bss, mf_abs};
  463.  
  464. struct misc_function
  465. {
  466.   char *name;
  467.   unsigned int  address;
  468.   unsigned char type;         
  469. };
  470.  
  471.  
  472.  
  473. struct misc_function *misc_function_vector;
  474. int misc_function_count;
  475.  
  476. # 1 "symseg.h" 1
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546. enum language {language_c};
  547.  
  548. struct symbol_root
  549. {
  550.   int format;             
  551.   int length;             
  552.   int ldsymoff;             
  553.   int textrel;             
  554.   int datarel;             
  555.   int bssrel;             
  556.   char *filename;         
  557.   char *filedir;         
  558.   struct blockvector *blockvector;  
  559.   struct typevector *typevector;  
  560.   enum language language;     
  561.   char *version;         
  562.   char *compilation;         
  563.   int databeg;             
  564.   int bssbeg;             
  565.   struct sourcevector *sourcevector;  
  566. };
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573. struct typevector
  574. {
  575.   int length;             
  576.   struct type *type[1];
  577. };
  578.  
  579.  
  580.  
  581. enum type_code
  582. {
  583.   TYPE_CODE_UNDEF,         
  584.   TYPE_CODE_PTR,         
  585.   TYPE_CODE_ARRAY,         
  586.   TYPE_CODE_STRUCT,         
  587.   TYPE_CODE_UNION,         
  588.   TYPE_CODE_ENUM,         
  589.   TYPE_CODE_FUNC,         
  590.   TYPE_CODE_INT,         
  591.   TYPE_CODE_FLT,         
  592.   TYPE_CODE_VOID,         
  593.   TYPE_CODE_SET,         
  594.   TYPE_CODE_RANGE,         
  595.   TYPE_CODE_PASCAL_ARRAY,     
  596.  
  597.    
  598.   TYPE_CODE_MEMBER,         
  599.   TYPE_CODE_METHOD,         
  600.   TYPE_CODE_REF,         
  601. };
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626. struct type
  627. {
  628.    
  629.   enum type_code code;
  630.    
  631.  
  632.  
  633.   char *name;
  634.    
  635.   int length;
  636.    
  637.  
  638.  
  639.  
  640.  
  641.   struct type *target_type;
  642.    
  643.  
  644.  
  645.  
  646.   struct type *pointer_type;
  647.    
  648.   struct type *reference_type;
  649.   struct type **arg_types;
  650.   
  651.    
  652.  
  653.  
  654.  
  655.   struct type *function_type;
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.   struct type *main_variant, *next_variant;
  665.  
  666.    
  667.   short flags;
  668.    
  669.   short nfields;
  670.    
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.   struct field
  682.     {
  683.        
  684.  
  685.  
  686.  
  687.       int bitpos;
  688.        
  689.  
  690.  
  691.       int bitsize;
  692.        
  693.  
  694.  
  695.       struct type *type;
  696.        
  697.  
  698.       char *name;
  699.     } *fields;
  700.  
  701.    
  702.   int *private_field_bits;
  703.   int *protected_field_bits;
  704.  
  705.    
  706.   short nfn_fields;
  707.    
  708.   short n_baseclasses;
  709.  
  710.    
  711.  
  712.   int nfn_fields_total;
  713.  
  714.    
  715.  
  716.  
  717.  
  718.   struct fn_fieldlist
  719.     {
  720.        
  721.       char *name;
  722.        
  723.       int length;
  724.        
  725.       struct fn_field
  726.     {
  727.  
  728.  
  729.  
  730.  
  731.        
  732.       struct type *type;
  733.        
  734.       struct type **args;
  735.        
  736.       char *physname;
  737.        
  738.  
  739.       int voffset;
  740.     } *fn_fields;
  741.  
  742.       int *private_fn_field_bits;
  743.       int *protected_fn_field_bits;
  744.  
  745.     } *fn_fieldlists;
  746.  
  747.   unsigned char via_protected;
  748.   unsigned char via_public;
  749.  
  750.    
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.   struct type *vptr_basetype;
  759.  
  760.   int vptr_fieldno;
  761.  
  762.    
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.   struct type **baseclasses;
  772. };
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800. struct blockvector
  801. {
  802.    
  803.   int nblocks;
  804.    
  805.   struct block *block[1];
  806. };
  807.  
  808. struct block
  809. {
  810.    
  811.  
  812.  
  813.  
  814.   int startaddr, endaddr;
  815.    
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.   struct symbol *function;
  825.    
  826.    
  827.  
  828.  
  829.  
  830.  
  831.   struct block *superblock;
  832.    
  833.  
  834.  
  835.  
  836.  
  837.   unsigned char gcc_compile_flag;
  838.    
  839.   int nsyms;
  840.    
  841.   struct symbol *sym[1];
  842. };
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866. enum namespace
  867. {
  868.   UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE,
  869. };
  870.  
  871.  
  872.  
  873. enum address_class
  874. {
  875.   LOC_UNDEF,         
  876.   LOC_CONST,         
  877.   LOC_STATIC,         
  878.   LOC_REGISTER,         
  879.   LOC_ARG,         
  880.   LOC_REF_ARG,         
  881.              
  882.   LOC_REGPARM,         
  883.   LOC_LOCAL,         
  884.   LOC_TYPEDEF,         
  885.  
  886.  
  887.   LOC_LABEL,         
  888.   LOC_BLOCK,         
  889.  
  890.   LOC_EXTERNAL,         
  891.  
  892.  
  893.  
  894.  
  895.   LOC_CONST_BYTES     
  896. };
  897.  
  898. struct symbol
  899. {
  900.    
  901.   char *name;
  902.    
  903.   enum namespace namespace;
  904.    
  905.   enum address_class class;
  906.    
  907.   struct type *type;
  908.    
  909.  
  910.   union
  911.     {
  912.       long value;
  913.       struct block *block;       
  914.       char *bytes;         
  915.     }
  916.   value;
  917. };
  918.  
  919. struct partial_symbol
  920. {
  921.    
  922.   char *name;
  923.    
  924.   enum namespace namespace;
  925.    
  926.   enum address_class class;
  927.    
  928.  
  929.  
  930.  
  931.  
  932.   union
  933.     {
  934.       long value;
  935.     }
  936.   value;
  937. };
  938.  
  939.  
  940.  
  941.  
  942.  
  943. extern struct psymbol_allocation_list {
  944.   struct partial_symbol *list, *next;
  945.   int size;
  946. } global_psymbols, static_psymbols;
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953. struct sourcevector
  954. {
  955.   int length;             
  956.   struct source *source[1];     
  957. };
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969. struct linetable_entry
  970. {
  971.   int line;
  972.   unsigned int  pc;
  973. };
  974.  
  975. struct linetable
  976. {
  977.   int nitems;
  978.   struct linetable_entry item[1];
  979. };
  980.  
  981.  
  982.  
  983. struct source
  984. {
  985.   char *name;             
  986.   struct linetable contents;
  987. };
  988. # 64 "symtab.h" 2
  989.  
  990.  
  991.  
  992.  
  993.  
  994. struct symtab
  995.   {
  996.      
  997.     struct symtab *next;
  998.      
  999.     struct blockvector *blockvector;
  1000.      
  1001.     struct linetable *linetable;
  1002.      
  1003.     struct typevector *typevector;
  1004.      
  1005.     char *filename;
  1006.      
  1007.  
  1008.  
  1009.  
  1010.  
  1011.     enum free_code {free_nothing, free_contents, free_linetable}
  1012.       free_code;
  1013.      
  1014.     char *free_ptr;
  1015.      
  1016.     int nlines;
  1017.      
  1018.     int *line_charpos;
  1019.      
  1020.     enum language language;
  1021.      
  1022.     char *version;
  1023.      
  1024.     char *compilation;
  1025.      
  1026.  
  1027.     int ldsymoff;
  1028.      
  1029.  
  1030.     char *fullname;
  1031.   };
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039. struct partial_symtab
  1040. {
  1041.    
  1042.   struct partial_symtab *next;
  1043.    
  1044.   char *filename;
  1045.    
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.   int ldsymoff, ldsymlen;
  1053.    
  1054.  
  1055.   int textlow, texthigh;
  1056.    
  1057.  
  1058.   unsigned char readin;
  1059.    
  1060.  
  1061.  
  1062.  
  1063.   struct partial_symtab **dependencies;
  1064.   int number_of_dependencies;
  1065.    
  1066.  
  1067.  
  1068.  
  1069.   int globals_offset, n_global_syms;
  1070.    
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.   int statics_offset, n_static_syms;
  1077. };
  1078.  
  1079.  
  1080.  
  1081. struct symtab *symtab_list;
  1082.  
  1083.  
  1084.  
  1085. struct partial_symtab *partial_symtab_list;
  1086.  
  1087.  
  1088.  
  1089. struct symtab *current_source_symtab;
  1090.  
  1091.  
  1092.  
  1093. int current_source_line;
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209. extern struct symtab *lookup_symtab ();
  1210. extern struct symbol *lookup_symbol ();
  1211. extern struct type *lookup_typename ();
  1212. extern struct type *lookup_unsigned_typename ();
  1213. extern struct type *lookup_struct ();
  1214. extern struct type *lookup_union ();
  1215. extern struct type *lookup_enum ();
  1216. extern struct type *lookup_struct_elt_type ();
  1217. extern struct type *lookup_pointer_type ();
  1218. extern struct type *lookup_function_type ();
  1219. extern struct type *lookup_basetype_type ();
  1220. extern struct type *create_array_type ();
  1221. extern struct symbol *block_function ();
  1222. extern struct symbol *find_pc_function ();
  1223. extern int find_pc_partial_function ();
  1224. extern struct partial_symtab *find_pc_psymtab ();
  1225. extern struct symtab *find_pc_symtab ();
  1226. extern struct partial_symbol *find_pc_psymbol ();
  1227. extern int find_pc_misc_function ();
  1228.  
  1229.  
  1230. extern struct type *lookup_reference_type ();
  1231. extern struct type *lookup_member_type ();
  1232. extern struct type *lookup_class ();
  1233.  
  1234.  
  1235. extern struct type *builtin_type_void;
  1236. extern struct type *builtin_type_char;
  1237. extern struct type *builtin_type_short;
  1238. extern struct type *builtin_type_int;
  1239. extern struct type *builtin_type_long;
  1240. extern struct type *builtin_type_unsigned_char;
  1241. extern struct type *builtin_type_unsigned_short;
  1242. extern struct type *builtin_type_unsigned_int;
  1243. extern struct type *builtin_type_unsigned_long;
  1244. extern struct type *builtin_type_float;
  1245. extern struct type *builtin_type_double;
  1246.  
  1247. # 334 "symtab.h"
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260. struct symtab_and_line
  1261. {
  1262.   struct symtab *symtab;
  1263.   int line;
  1264.   unsigned int  pc;
  1265.   unsigned int  end;
  1266. };
  1267.  
  1268. struct symtabs_and_lines
  1269. {
  1270.   struct symtab_and_line *sals;
  1271.   int nelts;
  1272. };
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278. struct symtab_and_line find_pc_line ();
  1279.  
  1280.  
  1281.  
  1282.  
  1283. struct symtabs_and_lines decode_line_spec ();
  1284. struct symtabs_and_lines decode_line_spec_1 ();
  1285. struct symtabs_and_lines decode_line_1 ();
  1286. # 23 "blockframe.c" 2
  1287.  
  1288. # 1 "frame.h" 1
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332. typedef struct frame_info *FRAME;
  1333. typedef unsigned int     FRAME_ADDR;
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. struct frame_info
  1347.   {
  1348.      
  1349.     FRAME_ADDR frame;
  1350.      
  1351.  
  1352.  
  1353.     unsigned int  pc;
  1354.      
  1355.  
  1356.  
  1357.  
  1358.     FRAME_ADDR next_frame;
  1359.      
  1360.  
  1361.  
  1362.  
  1363.  
  1364.      
  1365.     FRAME next, prev;
  1366.   };
  1367.  
  1368.  
  1369.  
  1370. struct frame_saved_regs
  1371.   {
  1372.      
  1373.  
  1374.     unsigned int  regs[NUM_REGS];
  1375.   };
  1376.  
  1377.  
  1378.  
  1379.  
  1380. extern FRAME selected_frame;
  1381.  
  1382. extern struct frame_info *get_frame_info ();
  1383. extern struct frame_info *get_prev_frame_info ();
  1384.  
  1385. extern FRAME create_new_frame ();
  1386.  
  1387. extern void get_frame_saved_regs ();
  1388.  
  1389. extern FRAME get_prev_frame ();
  1390. extern FRAME get_current_frame ();
  1391. extern FRAME get_next_frame ();
  1392.  
  1393. extern struct block *get_frame_block ();
  1394. extern struct block *get_current_block ();
  1395. extern struct block *get_selected_block ();
  1396. extern struct symbol *get_frame_function ();
  1397. extern struct symbol *get_pc_function ();
  1398.  
  1399.  
  1400. extern FRAME find_relative_frame ();
  1401.  
  1402.  
  1403.  
  1404. # 24 "blockframe.c" 2
  1405.  
  1406.  
  1407. # 1 "./obstack.h" 1
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516. # 371 "./obstack.h"
  1517.  
  1518.  
  1519. # 26 "blockframe.c" 2
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530. unsigned int  startup_file_start;
  1531. unsigned int  startup_file_end;
  1532.  
  1533.  
  1534. int
  1535. outside_startup_file (addr)
  1536.      unsigned int  addr;
  1537. {
  1538.   return !(addr >= startup_file_start && addr < startup_file_end);
  1539. }
  1540.  
  1541.  
  1542.  
  1543. static FRAME current_frame;
  1544.  
  1545. struct block *block_for_pc ();
  1546. unsigned int  get_pc_function_start ();
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553. struct obstack frame_cache_obstack;
  1554.  
  1555.  
  1556.  
  1557. FRAME
  1558. get_current_frame ()
  1559. {
  1560.    
  1561.  
  1562.  
  1563.   return current_frame;
  1564. }
  1565.  
  1566. void
  1567. set_current_frame (frame)
  1568.      FRAME frame;
  1569. {
  1570.   current_frame = frame;
  1571. }
  1572.  
  1573. FRAME
  1574. create_new_frame (addr, pc)
  1575.      FRAME_ADDR addr;
  1576.      unsigned int  pc;
  1577. {
  1578.   struct frame_info *fci;     
  1579.  
  1580.   fci = (struct frame_info *)
  1581.     ({ struct obstack *__h = (&frame_cache_obstack);    ({ struct obstack *__o = (__h);    int __len = ( (
  1582.            sizeof (struct frame_info)));    ((__o->next_free + __len > __o->chunk_limit)    ? _obstack_newchunk (__o, __len) : 0);    __o->next_free += __len;    (void) 0; }) ;    ({ struct obstack *__o = (__h);    void *value = (void *) __o->object_base;    __o->next_free    = (((((__o->next_free) - (char *)0) +__o->alignment_mask)    & ~ (__o->alignment_mask)) + (char *)0) ;    ((__o->next_free - (char *)__o->chunk    > __o->chunk_limit - (char *)__o->chunk)    ? (__o->next_free = __o->chunk_limit) : 0);    __o->object_base = __o->next_free;    value; }) ; }) ;
  1583.  
  1584.    
  1585.   fci->next = (struct frame_info *) 0;
  1586.   fci->prev = (struct frame_info *) 0;
  1587.   fci->frame = addr;
  1588.   fci->next_frame = 0;         
  1589.   fci->pc = pc;
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.   return fci;
  1596. }
  1597.  
  1598.  
  1599.  
  1600.  
  1601. FRAME
  1602. get_prev_frame (frame)
  1603.      FRAME frame;
  1604. {
  1605.    
  1606.  
  1607.   return get_prev_frame_info (frame);
  1608. }
  1609.  
  1610.  
  1611.  
  1612.  
  1613. FRAME
  1614. get_next_frame (frame)
  1615.      FRAME frame;
  1616. {
  1617.    
  1618.  
  1619.   return frame->next;
  1620. }
  1621.  
  1622.  
  1623.  
  1624.  
  1625. void
  1626. flush_cached_frames ()
  1627. {
  1628.    
  1629.   ({ struct obstack *__o = (&frame_cache_obstack);    void *__obj = ( 0);    if (__obj >= (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = __obj;    else (obstack_free) (__o, __obj); }) ;
  1630.   _obstack_begin ((&frame_cache_obstack), 0, 0, xmalloc , free ) ;
  1631.  
  1632.   current_frame = (struct frame_info *) 0;  
  1633. }
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642. struct frame_info *
  1643. get_frame_info (frame)
  1644.      FRAME frame;
  1645. {
  1646.   return frame;
  1647. }
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658. # 181 "blockframe.c"
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664. struct frame_info *
  1665. get_prev_frame_info (next_frame)
  1666.      FRAME next_frame;
  1667. {
  1668.   FRAME_ADDR address;
  1669.   struct frame_info *prev;
  1670.   int fromleaf = 0;
  1671.  
  1672.    
  1673.  
  1674.  
  1675.  
  1676.   if (!next_frame)
  1677.     {
  1678.       if (!current_frame)
  1679.     {
  1680.       if (!have_inferior_p () && !have_core_file_p ())
  1681.         fatal ("get_prev_frame_info: Called before cache primed.  \"Shouldn't happen.\"");
  1682.       else
  1683.         error ("No inferior or core file.");
  1684.     }
  1685.  
  1686.       return current_frame;
  1687.     }
  1688.  
  1689.    
  1690.   if (next_frame->prev)
  1691.     return next_frame->prev;
  1692.  
  1693.    
  1694.  
  1695.  
  1696.  
  1697.  
  1698. # 230 "blockframe.c"
  1699.  
  1700.  
  1701.   if (!fromleaf)
  1702.     {
  1703.        
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.       address = FRAME_CHAIN (next_frame);
  1717.       if (!FRAME_CHAIN_VALID (address, next_frame))
  1718.     return 0;
  1719.        
  1720.  
  1721.       address = FRAME_CHAIN_COMBINE (address, next_frame);
  1722.     }
  1723.  
  1724.   prev = (struct frame_info *)
  1725.     ({ struct obstack *__h = (&frame_cache_obstack);    ({ struct obstack *__o = (__h);    int __len = ( (
  1726.            sizeof (struct frame_info)));    ((__o->next_free + __len > __o->chunk_limit)    ? _obstack_newchunk (__o, __len) : 0);    __o->next_free += __len;    (void) 0; }) ;    ({ struct obstack *__o = (__h);    void *value = (void *) __o->object_base;    __o->next_free    = (((((__o->next_free) - (char *)0) +__o->alignment_mask)    & ~ (__o->alignment_mask)) + (char *)0) ;    ((__o->next_free - (char *)__o->chunk    > __o->chunk_limit - (char *)__o->chunk)    ? (__o->next_free = __o->chunk_limit) : 0);    __o->object_base = __o->next_free;    value; }) ; }) ;
  1727.  
  1728.   if (next_frame)
  1729.     next_frame->prev = prev;
  1730.   prev->next = next_frame;
  1731.   prev->prev = (struct frame_info *) 0;
  1732.   prev->frame = address;
  1733.   prev->next_frame = prev->next ? prev->next->frame : 0;
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.    
  1740.  
  1741.  
  1742.   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (next_frame) :
  1743.           next_frame ? FRAME_SAVED_PC (next_frame) : read_pc ());
  1744.  
  1745.   return prev;
  1746. }
  1747.  
  1748. unsigned int 
  1749. get_frame_pc (frame)
  1750.      FRAME frame;
  1751. {
  1752.   struct frame_info *fi;
  1753.   fi = get_frame_info (frame);
  1754.   return fi->pc;
  1755. }
  1756.  
  1757.  
  1758.  
  1759. void
  1760. get_frame_saved_regs (frame_info_addr, saved_regs_addr)
  1761.      struct frame_info *frame_info_addr;
  1762.      struct frame_saved_regs *saved_regs_addr;
  1763. {
  1764.   FRAME_FIND_SAVED_REGS (frame_info_addr, *saved_regs_addr);
  1765. }
  1766.  
  1767.  
  1768.  
  1769.  
  1770. struct block *
  1771. get_frame_block (frame)
  1772.      FRAME frame;
  1773. {
  1774.   struct frame_info *fi;
  1775.   unsigned int  pc;
  1776.  
  1777.   fi = get_frame_info (frame);
  1778.  
  1779.   pc = fi->pc;
  1780.   if (fi->next_frame != 0)
  1781.      
  1782.  
  1783.  
  1784.  
  1785.  
  1786.     --pc;
  1787.   return block_for_pc (pc);
  1788. }
  1789.  
  1790. struct block *
  1791. get_current_block ()
  1792. {
  1793.   return block_for_pc (read_pc ());
  1794. }
  1795.  
  1796. unsigned int 
  1797. get_pc_function_start (pc)
  1798.      unsigned int  pc;
  1799. {
  1800.   register struct block *bl = block_for_pc (pc);
  1801.   register struct symbol *symbol;
  1802.   if (bl == 0 || (symbol = block_function (bl)) == 0)
  1803.     {
  1804.       register int misc_index = find_pc_misc_function (pc);
  1805.       if (misc_index >= 0)
  1806.     return misc_function_vector[misc_index].address;
  1807.       return 0;
  1808.     }
  1809.   bl = (symbol)->value.block ;
  1810.   return (bl)->startaddr ;
  1811. }
  1812.  
  1813.  
  1814.  
  1815. struct symbol *
  1816. get_frame_function (frame)
  1817.      FRAME frame;
  1818. {
  1819.   register struct block *bl = get_frame_block (frame);
  1820.   if (bl == 0)
  1821.     return 0;
  1822.   return block_function (bl);
  1823. }
  1824.  
  1825.  
  1826.  
  1827.  
  1828. extern struct symtab *psymtab_to_symtab ();
  1829.  
  1830. struct block *
  1831. block_for_pc (pc)
  1832.      register unsigned int  pc;
  1833. {
  1834.   register struct block *b;
  1835.   register int bot, top, half;
  1836.   register struct symtab *s;
  1837.   register struct partial_symtab *ps;
  1838.   struct blockvector *bl;
  1839.  
  1840.    
  1841.  
  1842.   for (s = symtab_list; s; s = s->next)
  1843.     {
  1844.       bl = (s)->blockvector ;
  1845.       b = (bl)->block[ 0] ;
  1846.       if ((b)->startaddr  <= pc
  1847.       && (b)->endaddr  > pc)
  1848.     break;
  1849.     }
  1850.  
  1851.   if (s == 0)
  1852.     for (ps = partial_symtab_list; ps; ps = ps->next)
  1853.       {
  1854.     if (ps->textlow <= pc
  1855.         && ps->texthigh > pc)
  1856.       {
  1857.         if (ps->readin)
  1858.           fatal ("Internal error: pc found in readin psymtab and not in any symtab.");
  1859.         s = psymtab_to_symtab (ps);
  1860.         bl = (s)->blockvector ;
  1861.         b = (bl)->block[ 0] ;
  1862.         break;
  1863.       }
  1864.       }
  1865.  
  1866.   if (s == 0)
  1867.     return 0;
  1868.  
  1869.    
  1870.    
  1871.  
  1872.   bot = 0;
  1873.   top = (bl)->nblocks ;
  1874.  
  1875.   while (top - bot > 1)
  1876.     {
  1877.       half = (top - bot + 1) >> 1;
  1878.       b = (bl)->block[ bot + half] ;
  1879.       if ((b)->startaddr  <= pc)
  1880.     bot += half;
  1881.       else
  1882.     top = bot + half;
  1883.     }
  1884.  
  1885.    
  1886.  
  1887.   while (bot >= 0)
  1888.     {
  1889.       b = (bl)->block[ bot] ;
  1890.       if ((b)->endaddr  > pc)
  1891.     return b;
  1892.       bot--;
  1893.     }
  1894.  
  1895.   return 0;
  1896. }
  1897.  
  1898.  
  1899.  
  1900.  
  1901. struct symbol *
  1902. find_pc_function (pc)
  1903.      unsigned int  pc;
  1904. {
  1905.   register struct block *b = block_for_pc (pc);
  1906.   if (b == 0)
  1907.     return 0;
  1908.   return block_function (b);
  1909. }
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. int
  1919. find_pc_partial_function (pc, name, address)
  1920.      unsigned int  pc;
  1921.      char **name;
  1922.      unsigned int  *address;
  1923. {
  1924.   struct partial_symtab *pst = find_pc_psymtab (pc);
  1925.   struct symbol *f;
  1926.   int miscfunc;
  1927.   struct partial_symbol *psb;
  1928.  
  1929.   if (pst)
  1930.     {
  1931.       if (pst->readin)
  1932.     {
  1933.        
  1934.  
  1935.  
  1936.       f = find_pc_function (pc);
  1937.       if (!f)
  1938.         {
  1939.         return_error:
  1940.            
  1941.           if (name != 0)
  1942.         *name = 0;
  1943.           if (address != 0)
  1944.         *address = 0;
  1945.           return 0;
  1946.         }
  1947.  
  1948.       if (name)
  1949.         *name = (f)->name ;
  1950.       if (address)
  1951.         *address = ((f)->value.block )->startaddr ;
  1952.       return 1;
  1953.     }
  1954.  
  1955.        
  1956.  
  1957.  
  1958.       miscfunc = find_pc_misc_function (pc);
  1959.       psb = find_pc_psymbol (pst, pc);
  1960.  
  1961.       if (!psb && miscfunc == -1)
  1962.     {
  1963.       goto return_error;
  1964.     }
  1965.       if (!psb
  1966.       || (miscfunc != -1
  1967.           && ((psb)->value.value 
  1968.           < misc_function_vector[miscfunc].address)))
  1969.     {
  1970.       if (address)
  1971.         *address = misc_function_vector[miscfunc].address;
  1972.       if (name)
  1973.         *name = misc_function_vector[miscfunc].name;
  1974.       return 1;
  1975.     }
  1976.       else
  1977.     {
  1978.       if (address)
  1979.         *address = (psb)->value.value ;
  1980.       if (name)
  1981.         *name = (psb)->name ;
  1982.       return 1;
  1983.     }
  1984.     }
  1985.   else
  1986.      
  1987.     {
  1988.       miscfunc = find_pc_misc_function (pc);
  1989.       if (miscfunc == -1)
  1990.     goto return_error;
  1991.       if (address)
  1992.     *address = misc_function_vector[miscfunc].address;
  1993.       if (name)
  1994.     *name = misc_function_vector[miscfunc].name;
  1995.       return 1;
  1996.     }
  1997. }
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003. int
  2004. find_pc_misc_function (pc)
  2005.      register unsigned int  pc;
  2006. {
  2007.   register int lo = 0;
  2008.   register int hi = misc_function_count-1;
  2009.   register int new;
  2010.   register int distance;
  2011.  
  2012.    
  2013.    
  2014.  
  2015.  
  2016.    
  2017.    
  2018.   if (hi < 0) return -1;         
  2019.  
  2020.    
  2021.   if (pc < misc_function_vector[0].address ||
  2022.       pc > misc_function_vector[hi].address)
  2023.     return -1;
  2024.  
  2025.    
  2026.  
  2027.  
  2028.  
  2029.  
  2030.   do {
  2031.     new = (lo + hi) >> 1;
  2032.     distance = misc_function_vector[new].address - pc;
  2033.     if (distance == 0)
  2034.       return new;         
  2035.     else if (distance > 0)
  2036.       hi = new;
  2037.     else
  2038.       lo = new;
  2039.   } while (hi-lo != 1);
  2040.  
  2041.    
  2042.   return lo;
  2043. }
  2044.  
  2045.  
  2046.  
  2047.  
  2048. FRAME
  2049. block_innermost_frame (block)
  2050.      struct block *block;
  2051. {
  2052.   struct frame_info *fi;
  2053.   register FRAME frame;
  2054.   register unsigned int  start = (block)->startaddr ;
  2055.   register unsigned int  end = (block)->endaddr ;
  2056.  
  2057.   frame = 0;
  2058.   while (1)
  2059.     {
  2060.       frame = get_prev_frame (frame);
  2061.       if (frame == 0)
  2062.     return 0;
  2063.       fi = get_frame_info (frame);
  2064.       if (fi->pc >= start && fi->pc < end)
  2065.     return frame;
  2066.     }
  2067. }
  2068.  
  2069. void
  2070. _initialize_blockframe ()
  2071. {
  2072.   _obstack_begin ((&frame_cache_obstack), 0, 0, xmalloc , free ) ;
  2073. }
  2074.